<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Web_config_m extends MY_Model
{
	function __construct()
	{
		parent::__construct();
	}
	
	function get_web_config()
	{
		$config_arr = array();
		$query = $this->db->get('config_global');
		
		// 返回以配置名称为索引，配置内容为该索引内容的数组
		foreach ($query->result() as $value)
		{
			$config_arr[$value->skey] = $value->svalue;
		}
		return $config_arr;
	}
	
	function update_config_batch($config_arr, $where)
	{
		if (is_array($config_arr) && !empty($config_arr))
		{
			$this->db->update_batch('config_global', $config_arr, $where);
			return TRUE;
		}
		else
		{
			return FALSE;
		}
	}
	
	function update_config($where, $config_arr)
	{
		return $this->update('config_global', $where, $config_arr);
	}
}

/* End of file web_config_m.php */
/* Location: ./application/controllers/web_config_m.php */